#include "Vertex.h"

Vertex::Vertex(double _x,  double  _y):
x(_x),  y(_y)
{

}

Vertex Vertex::operator+(Vertex &p)
{
	return Vertex(x +  p.x,  y +  p.y);
}

Vertex  Vertex::operator-(Vertex  &p)
{
	return Vertex(x - p.x,  y - p.y);
}

Vertex  operator*(double  s,  Vertex  &p)
{
	return Vertex(s  *  p.x,  s *  p.y);
}

double Vertex::operator[](int  i)
{
	return  (i ==  0) ? x  : y;
}

int  Vertex::operator==(Vertex  &p)
{
	return  ((x ==  p.x)  &&  (y ==  p.y));
}

int  Vertex::operator!=(Vertex  &p)
{
	return !(*this  ==  p);
}

int  Vertex::operator<(Vertex &p)
{
	return  ((x  <  p.x)  ||  ((x  ==  p.x)  &&  (y  <  p.y)));
}

int  Vertex::operator>(Vertex &p)
{
	return  ((x  >  p.x)  |  ((x  ==  p.x)  &&  (y  >  p.y)));
}

Vertex::~Vertex(void)
{
}
